<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of article
 *
 * @author Administrator
 */
class caijijiejuefangan extends CI_Controller {

    private $page_size=10;

    public function __construct() {
        parent::__construct();
        $this->url = $this->uri->segments;
        $this->CI = & get_instance();
    }

    public function index() {
        $g_nav_list = $this->CI->load->get_var('g_nav_list');//获取导航
        $data = $this->return_classid($g_nav_list);
        $this->CI->load->library('a_class');
        $page = isset($_GET['page'])?$_GET['page']:1;//当前页
        $data['content'] = $this->CI->a_class->get_class((int) $data['classid']);
        $this->load->helper('array_func_helper');
        $this->load->view('template_abo',$data);
    }

    private function return_classid($nav_one=array()){
        if(empty($nav_one)){
            return ;
        }else{
            $return = array();
            foreach($nav_one as $k=>$v){
                if(!empty($v['child'])){
                    foreach ($v['child'] as $key => $value) {
                        if($value['classlinkname'] == $this->url[2]){
                            $return['nav_new'] = $v['child'];
                            $return['classid'] = $value['classid'];
                            $return['parentid'] = $v['classid'];
                        }else{
                            continue;
                        }
                    }
                }else{
                    continue;
                }
            }
            return $return ;
        }
    }
}
